#!/bin/bash
#author:suquan 240129745@qq.com
#version:v1.2
#install
if [  ! -e "/bin/dict" ]
then
	sudo cp $PWD/dict /bin/dict
	echo "Now the dict has moved to /bin/dict,you can try it again!"
	exit 2
fi
if [[ $# -lt 1 ]]
then
	echo "Usage: $0 word"
	exit 1
fi

url=www.dict.cn
which lynx >/dev/null
if [[ $? -ne 0 ]]
then
	echo "sorry,can not found the lynx,pls install it!!!"
	exit 1
fi
dictfile=/tmp/dict-$1-$$
lynx -dump -nolist $url/$1 |grep -v "#alternate"|grep -v "的英文翻译是什么意思"|sed '/基本词汇/d'|grep '@海词词典' -B 1000|head -n -1|tee $dictfile|less
